/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tetris_invader.itens;

import java.awt.Image;
import java.awt.Point;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
import tetris_invader.util.Fase;

/**
 * item de vida. Aumenta o numero de vidas do jogador
 * @author Rafael
 */
public class Life_Item extends Item {

    private Player lifefx;

    public Life_Item(Fase fase, Image imagens[]) {
        super(fase, imagens);

        Random r = new Random();
        this.posicao = new Point(r.nextInt(550), 300 + r.nextInt(250));

        try {
            FileInputStream log;
            try {
                log = new FileInputStream("src/sound/life.mp3");
                lifefx = new Player(log);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(Life_Item.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (JavaLayerException ex) {
            Logger.getLogger(Life_Item.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void start(){
        try {
            lifefx.play();
        } catch (JavaLayerException ex) {
            Logger.getLogger(Life_Item.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void deslocamento() {
    }
}
